Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/gateway: escape directory redirect url #779

Merged
merged 5 commits into from
Jan 3, 2025

Conversation

gammazero
Copy link
Contributor

@gammazero gammazero commented Jan 2, 2025

When a directory gets redirected to a URL with a treailing slash, special chars in the directory name must be escaped in the redirect URL.

Depends on ipfs/gateway-conformance#225
Required by: ipfs/kubo#10649

Fixes issue ipfs/kubo#10536

TODO:

  • Merge gateway-conformance PR and bump version
  • Update to latest gateway-conformance version in .github/workflows/gateway-sharness.yml
  • Remove ref from .github/workflows/gateway-sharness.yml after merge of this PR and merge of kubo PR

@gammazero gammazero requested review from lidel and a team as code owners January 2, 2025 09:53
@gammazero gammazero changed the title Fix web links for directories with "%" in name fix/gateway: web links for directories with "%" in name Jan 2, 2025
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.49%. Comparing base (85fbc3a) to head (00b4386).
Report is 1 commits behind head on main.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #779      +/-   ##
==========================================
- Coverage   60.51%   60.49%   -0.02%     
==========================================
  Files         245      245              
  Lines       31126    31126              
==========================================
- Hits        18835    18831       -4     
- Misses      10622    10623       +1     
- Partials     1669     1672       +3     
Files with missing lines Coverage Δ
gateway/handler_unixfs_dir.go 65.88% <100.00%> (-2.36%) ⬇️

... and 9 files with indirect coverage changes

Directories with a "%" in their name do not work correctly when when redirected to a URL with a trailing slash. When the original URl contains special characters, such as "%", the correcponding redirect URL must escape these characters.

Fixes issue ipfs/kubo#10536
@gammazero gammazero force-pushed the fix-gateway/percent-in-dirname branch from f71abb0 to 16d89a5 Compare January 2, 2025 12:08
@gammazero gammazero changed the title fix/gateway: web links for directories with "%" in name fix/gateway: escape directory redirect url Jan 2, 2025
@gammazero gammazero merged commit 5810fed into main Jan 3, 2025
18 checks passed
@gammazero gammazero deleted the fix-gateway/percent-in-dirname branch January 3, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants